A virtualization technology can implement dynamic allocation, flexible scheduling, and cross-domain sharing of Internet resources to improve IT resource utilization, and therefore becomes a new development trend of the Internet.
An accelerator is a type of Internet resource and a function unit. It offloads some original CPU functions onto the accelerator for processing, to reduce load on a CPU. Currently, widely used accelerators include graphics accelerators, cryptographic accelerators, video codec accelerators, compression accelerators, and the like. However, currently, it is increasingly difficult to meet an offload requirement of the CPU using a single accelerator. To improve performance of the accelerator, the accelerator urgently needs to be combined with an Internet resource virtualization technology. In a VirtIO solution, a virtual machine monitor creates a pair of transmit and receive queues for each virtual acceleration resource. The transmit and receive queues are implemented based on a shared memory. The virtual acceleration resource accesses a physical acceleration resource using the transmit and receive queues. The virtual machine monitor schedules the transmit and receive queues of each virtual acceleration resource, to implement access to the physical acceleration resource.
In the prior art, virtualization of the Internet resources generally has two methods: a VirtIO solution, and an SRIOV (single-root IO virtualization) solution. In the VirtIO solution, a virtual machine monitor (also referred to as virtual machine manager, or hypervisor hypervisor) creates a pair of transmit and receive queues for each virtual resource, and the virtual resource accesses a physical resource using the transmit and receive queues and by scheduling by the virtual machine monitor. The SRIOV solution is a PCIe bus-based IO virtualization technology, and a physical resource is interconnected with a CPU using a PCIe bus. In the SRIOV solution, a transmit and receive queue is integrated into hardware using software, and the hardware can be directly accessed from a virtual machine, thereby improving performance.
With the virtualization technology, a physical resource may be virtualized into multiple virtual resources. The multiple virtual resources are combined to form a virtual machine. Service processing units may be deployed on the virtual machine to implement different service functions. A typical virtualization system, as shown in FIG. 1, includes a centralized resource manager 101, a virtual machine monitor 102, and virtual machines 103 and 104. The centralized resource manager and the virtual machine monitor may be implemented based on software of a physical CPU. The software may be some function modules of an operating system or some relatively independent function software; a specific form is not limited. The centralized resource manager 101 is configured to manage various physical resources 107, and specific representative products include open-source software openstack, VMware company's vCenter, Huawei's FusionSphere, and the like. The virtual machine monitor 102 is configured to manage virtual resources. As shown in FIG. 1, a service processing unit 105 is deployed on the virtual machine 103, and a service processing unit 106 is deployed on the virtual machine 104. Workloads separately run on the service processing units 105 and 106. There may be multiple service loads running on each service processing unit. A virtual resource on the virtual machine may be divided by attribute into a virtual computing resource, a virtual storage resource, a virtual network interface card resource, and the like. Likewise, a physical resource may be divided into a physical computing resource, a physical storage resource, and a physical network interface card resource. The virtual machine accesses a corresponding physical resource using a virtual resource and transfers a workload to the corresponding physical resource.
However, virtualization of an accelerator cannot be implemented using a prior-art virtualization technology, and a virtual machine including a virtual accelerator cannot be created. As a result, the accelerator cannot be used in a virtual machine.